home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
2499.ZIP
/
NOTEPAD4.ZIP
/
NOTEPAD4.TXT
< prev
Wrap
Text File
|
1990-07-23
|
4KB
|
82 lines
Notepad4
--------
Notepad4 is a small and simple program which is designed to make
it easier to use Notepad as a program editor under Microsoft Windows.
It starts up Notepad, and then sends a message to the Notepad window
resetting the tab stops to be every four characters.
Notepad normally has tab stops set at every eight characters. For
the purposes of developing C language programs, eight is really too
large. After a few levels of indenting, program lines are located
so far to the right that they have to be made very short in order to
fit. Four-space tab stops allow you to indent freely and still give
you a reasonable amount of space for writing lines of code. Notepad4's
only function is to change the tab stops in the Notepad program.
Notepad has another deficiency when used as a program editor. It
defaults to looking for files of the form *.TXT when you use its
"Open..." command. I have found an easy way to improve this behavior,
though.
Make a backup copy of the NOTEPAD.EXE that comes with Windows. Run
Windows Write and open up NOTEPAD.EXE. Although Write is designed as
a text editor, it will allow you to open binary files like this one.
Specify "No Conversion" when Write asks you if you want to convert
the file to Write format. Write will open the file and display it
as mostly a lot of non-printable characters.
Use Write's "Find..." command to search for the string "*.EXE". When
you find it, delete that string and replace it with "*.* ". That's
"star dot star space space". It's important that you don't replace
it with just "*.*". You have to add the two spaces so that the whole
string is still exactly five characters long.
Search for "*.EXE" again; there are two occurances in the file. Replace
the second one with "*.* " also. Then save the file.
The resulting Notepad will work just like the original Notepad,
except that it will look for "*.*" instead of "*.EXE" when you use
the "Open..." command. This way you can use it easily to open up
*.C, *.H, *.DEF, and other files.
Another tip, if you want to use Notepad for program editing, is to
use the "Associate..." command in the File Manager to associate Notepad
with .C, .H, .DEF and other files that you want to edit with Notepad.
And here's where Notepad4 comes in. Put it in your search path, and
instead of associating Notepad with these program source files,
associate Notepad4. Then, if you double-click on a .C file, it will
run Notepad4 before opening your program, and you will get the four
character tab stops in Notepad.
One thing should be kept in mind in using Notepad4. Notepad, whether
started up in the normal mode or through Notepad4, stores tab characters
in the file as actual tabs. It does not replace them with spaces. So
if you type "<tab><tab><tab><tab>for (i=0; i<n; ++i)" as a line of code,
that line will be actually stored with four tabs. Notepad4 will only
show the "for" statement as tabbed in 16 (four times four) spaces.
But if you were to later look at that same file using another editor
which used different tab stops, you will see it indented differently.
In particular, if you later look at it using regular Notepad, you will
see it with 32 spaces of indentation. The file is no different in
either case, it's just that the tabs are being interpreted differently
by the two programs.
This will also have an effect if you look at some code that was written
and indented on the assumption of eight-character tabs. The sample
programs that come with the Windows SDK are like that. Although four
character indenting is the style that is generally used, this is done
by a mixture of eight character tab stops and manual typing of four
spaces. When viewed by Notepad4 with its four character tab stops,
lines are no longer indented properly. You can get around that by just
using Notepad to look at such old code.
Please report any problems with Notepad4 to me. The program is free and
in the public domain.
Hal Finney
Epic Systems Group
Compuserve: [74076,1041]
Internet: hal@symult.com